<template>
  <div class="box">
    <el-row>
      <el-col class="Centera" style="">
        <el-card
          class="box-card"
          v-for="(i, index) in iconlist"
          :key="index"
          @click.native="routerTo(i.router)"
        >
          <div
            style="
              line-height: 1.2;
              display: flex;
              flex-direction: column;
              align-items: center;
              justify-content: center;
              height: 100%;
            "
            :class="i.router == $route.path ? 'action' : ''"
          >
            <svg class="icon" style="margin: 0" aria-hidden="true">
              <use class="sdasdfs" :xlink:href="i.icon"></use>
            </svg>
            <p class="Textsize" style="margin: 0; margin-top: 17px">
              {{ i.name }}
            </p>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>
<script>
export default {
  data() {
    return {
      tab: true,
      iconlist: [
        {
          icon: "#icon-tezhongshebei",
          name: "特种设备作业人员培训系统",
          router: "/specialJoy",
        },
        {
          icon: "#icon-a-bianzu22",
          name: "特种作业人员培训学习系统",
          router: "/specialFacility",
        },
        {
          icon: "#icon-baoguo",
          name: "一般工贸行业管理人员培训系统",
          router: "/ordinary",
        },
        {
          icon: "#icon-tz-jiaotongyunshu",
          name: "交通运输行业在线培训系统",
          router: "/transportation",
        },
        {
          icon: "#icon-yiyuanjiuzhen",
          name: "职业卫生安全管理培训系统",
          router: "/occupation",
        },
        {
          icon: "#icon-a-bianzu11",
          name: "企业安全生产培训学习系统",
          router: "/enterprise",
        },
        {
          icon: "#icon-yuanqu",
          name: "化工园区安全教育培训系统",
          router: "/chemical",
        },
        {
          icon: "#icon-a-bianzu92",
          name: "企业安全生产智慧管理平台",
          router: "/enterpriseTrain",
        },
      ],
    };
  },
  methods: {
    routerTo(e) {
      // 点击卡片跳转router
      this.$router.push(e);
    },
  },
};
</script>
<style lang="less" scoped>
* {
  margin: auto;
}
.box {
  position: absolute;
  left: 0;
  right: 0;
  height: 200px;
  background: #f7f9ff;
  cursor: pointer;
  display: flex;
  margin: 0;
  top: 80px;
  .Centera {
    display: flex;
    margin: 0;
    width: 1200px;
    height: 200px;
  }
  .box-card {
    width: 140px;
    height: 128px;
    margin-left: 10px;
    // margin-top: 32px;
    &::v-deep {
      .el-card__body {
        padding: 0;
        height: 100%;
        width: 100%;
      }
    }
    p {
      width: 100px;
      font-size: 14px;
      line-height: 1.2;
    }
  }
  .box-card:hover {
    color: #0052d9;
  }
  .sdasdfs {
    margin-left: 2rem;
  }
  .icon {
    margin-left: 30px;
    width: 35px !important;
    height: 35px !important;
  }
}
.action {
  color: #0052d9;
}
</style>
